
package com.iceland.server;


import com.iceland.common.monitor.Info;
import com.iceland.common.monitor.InfoMonitor;
import com.iceland.common.thread.MessageEventExcutor;
import com.iceland.server.config.Environment;
import com.iceland.server.config.ProxyConfig;
import com.iceland.server.server.cmd.CmdServer;
import com.iceland.server.server.proxy.ProxyHandler;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ServerApplication  {

    public static void main(String[] args) throws InterruptedException {


        preStart();

        //开启命令服务器
        CmdServer clientServer=new CmdServer();
        ProxyConfig proxyConfig = Environment.getProxyConfig();
        MessageEventExcutor.setCorePoolSize(proxyConfig.getCoreMessageEventThreadSize());
        MessageEventExcutor.setMaxPoolSize(proxyConfig.getMaxMessageEventThreadSize());
        int port = clientServer.startServer(proxyConfig.getCmdServer().getPort());
        log.info("启动命令服务器,port:{}",port);

    }

    public static void preStart(){

//        InfoMonitor.addInfo(new Info("所有代理服务器成功连接数:{},失败连接数:{}", ProxyHandler.successChannels,ProxyHandler.failureChannels));
//        InfoMonitor.start();
    }

}

